package cn.jhc.servlet;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.jhc.dao.ShopDAO;
@WebServlet("/alterjitadata.do")
public class AlterJitadataServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
		throws ServletException, IOException {
	req.setCharacterEncoding("UTF-8");
	String isbn=req.getParameter("isbn");
	String title=req.getParameter("title");
	String address=req.getParameter("address");
	String manufacturers=req.getParameter("manufacturers");
	int amount=Integer.parseInt(req.getParameter("amount"));
	Double price=Double.parseDouble(req.getParameter("price"));
	String publish_date=req.getParameter("publish_date");
	String remark=req.getParameter("remark");
	System.out.println(isbn);
	System.out.println(title);
	System.out.println(address);
	System.out.println(manufacturers);
	System.out.println(amount);
	System.out.println(price);
	System.out.println(publish_date);
	System.out.println(remark);
	ShopDAO dao=new ShopDAO();
	try{
		dao.alterjiadata(isbn, title, price, address, manufacturers, amount, publish_date, remark);
	}catch (Exception e) {
		e.printStackTrace();
	}
	RequestDispatcher dispatcher = req
			.getRequestDispatcher("/alterjitadata.jsp");
	dispatcher.forward(req, resp);
	
}
@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doPost(req, resp);
	}
}
